<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div></div>
    <script>
        var div = document.querySelector('div');
        var time = 5;

        fn();//提前调用一次，防止页面刷新重绘空白
        setInterval(function(){
            fn();
        },1000);
        function fn(){
            if(time == 0){
                location.href = 'https://www.bilibili.com/';
            }else{
                div.innerHTML = '您还剩'+time+'秒跳转到哔哩哔哩~~~';
                time--;
            }
        }
    </script>
</body>
</html>